<?php session_start(); ?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

    <link rel="stylesheet" type="text/css" href="vista/bibestilo.css" />
		<script type="text/javascript" src="controlador/jquery.js"></script>   
		<script type="text/javascript" src="controlador/mat.js"></script>
    </head>

    <?php include ("./vista/menu.inc"); ?>

    <body>

	<div id="top">
		<div id="session">
			<?php
				include('./vista/session.inc');	
			?>
		</div>
		<div id="menu">
			<ul class="lavaLamp">
			    <li><a href="index.php">Inicio</a></li>
			    <li class="current"><a href="buscar.php">Búsqueda</a></li>
			    <li><a href="#">Login</a></li>
			</ul>
		</div>

	</div>
	<div id="logo"></div>
	<div id="separador"></div>
		
		<div id='contenedor'>
		
	        <div id="contenidoindex">
	        	
				<h3>Seleccione el año y materia de la carrera que desea consultar</h3><br>
				
				<ul>
					<li> <a id='click1' href=''>Primer año</a>
					<div id="mat1">
						<?php
						$conexion = mysql_connect(localhost,CEIC,CEICCEIC);
						mysql_select_db('BIBLIOTECA');
						$query = "SELECT * FROM MATERIA WHERE ANO='1' ORDER BY TRIMESTRE";
						$result = mysql_query($query);
					
						$tri = 0;
						echo "<ul>";
						while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
							if ($tri != $row['trimestre']) {
								echo "</ul>";
								$tri = $row['trimestre'];
								echo "<h4>Trimestre ".$row['trimestre']."</h4>";
								echo "<ul>";
							}
		 					echo "<li><a href='materia.php?materia=".$row['nombre']."'>".$row['nombre']."</a>";  
						}
						echo "</ul>";
					
						?>

					</div>
					<li> <a id='click2' href=''>Segundo año</a>
					<div id="mat2">
						<?php
						$conexion = mysql_connect(localhost,CEIC,CEICCEIC);
						mysql_select_db('BIBLIOTECA');
						$query = "SELECT * FROM MATERIA WHERE ANO='2' ORDER BY TRIMESTRE";
						$result = mysql_query($query);
					
						$tri = 0;
						echo "<ul>";
						while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
							if ($tri != $row['trimestre']) {
								echo "</ul>";
								$tri = $row['trimestre'];
								echo "<h4>Trimestre ".$row['trimestre']."</h4>";
								echo "<ul>";
							}
		 					echo "<li><a href='materia.php?materia=".$row['nombre']."'>".$row['nombre']."</a>";  
						}
						echo "</ul>";
					
						?>

					</div>
					<li> <a id='click3' href=''>Tercer año</a>
					<div id="mat3">
						<?php
						$conexion = mysql_connect(localhost,CEIC,CEICCEIC);
						mysql_select_db('BIBLIOTECA');
						$query = "SELECT * FROM MATERIA WHERE ANO='3' ORDER BY TRIMESTRE";
						$result = mysql_query($query);
					
						$tri = 0;
						echo "<ul>";
						while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
							if ($tri != $row['trimestre']) {
								echo "</ul>";
								$tri = $row['trimestre'];
								echo "<h4>Trimestre ".$row['trimestre']."</h4>";
								echo "<ul>";
							}
		 					echo "<li><a href='materia.php?materia=".$row['nombre']."'>".$row['nombre']."</a>";  
						}
						echo "</ul>";
					
						?>

					</div>
					<li> <a id='click4' href=''>Cuarto año</a>
					<div id="mat4">
						<?php
						$conexion = mysql_connect(localhost,CEIC,CEICCEIC);
						mysql_select_db('BIBLIOTECA');
						$query = "SELECT * FROM MATERIA WHERE ANO='4' ORDER BY TRIMESTRE";
						$result = mysql_query($query);
					
						$tri = 0;
						echo "<ul>";
						while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
							if ($tri != $row['trimestre']) {
								echo "</ul>";
								$tri = $row['trimestre'];
								echo "<h4>Trimestre ".$row['trimestre']."</h4>";
								echo "<ul>";
							}
		 					echo "<li><a href='materia.php?materia=".$row['nombre']."'>".$row['nombre']."</a>";  
						}
						echo "</ul>";
					
						?>

					</div>
					<li> <a id='click5' href=''>Electivas Libres y de Área</a>
					<div id="mat5">
						<?php
						$conexion = mysql_connect(localhost,CEIC,CEICCEIC);
						mysql_select_db('BIBLIOTECA');
						$query = "SELECT * FROM MATERIA WHERE ANO='5' ORDER BY TRIMESTRE";
						$result = mysql_query($query);
					
						$tri = 0;
						echo "<ul>";
						while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
							if ($tri != $row['trimestre']) {
								echo "</ul>";
								$tri = $row['trimestre'];
								echo "<h4>Trimestre ".$row['trimestre']."</h4>";
								echo "<ul>";
							}
		 					echo "<li><a href='materia.php?materia=".$row['nombre']."'>".$row['nombre']."</a>";  
						}
						echo "</ul>";
					
						?>

					</div>
				</ul>
				
	        </div>
			
        <?php include ("vista/footer.inc"); ?>
	
	</div>

    </body>
</html>
